#include <iostream>
#include <math.h>
#include <conio.h>

double f(double x, double y)
{
	return cos(y / sqrt(3.0)) + x;
}

double rungekutta(double x, double y, double h)
{
	double k1 = h*f(x,y);
	double k2 = h*f(x + h / 2.0, y + k1 / 2.0);
	double k3 = h*f(x + h / 2.0, y + k2 / 2.0);
	double k4 = h*f(x+h, y+k3);

	return y + (k1 + 2.0*k2 + 2.0*k3 + k4) / 6.0;
}

int main(int argc, char argv[])
{
	double h = 0.1;
	double a = 1.2;
	double b = 2.2;
	int n = (b-a) / h;

	double x = 1.2;
	double y = 2.1;

	std::cout << "X = " << x << "     Y = " << y << "\n";

	for(int i=0; i<n; i++)
	{
		y = rungekutta(x, y, h);
		x += h;
		std::cout << "X = " << x << "     Y = " << y << "\n";
	}

	getch();

	return 0;
}
